package main

import (
	"gitee.com/fanchenggang/SecKill/layer/service"
	"github.com/astaxie/beego/logs"
)

func main() {
	//加载配置文件
	err := initConfig("ini", "./conf/layer.conf")
	if err != nil {
		logs.Error("init config failed, err:%v", err)
		panic(err)
	}

	//初始化日志库
	err = initLogger()
	if err != nil {
		logs.Error("init logger failed, err:%v", err)
		panic(err)
	}

	//初始化秒杀逻辑
	err = service.InitSecLayer(appConfig)
	if err != nil {
		logs.Error("init seckill failed, err:%v", err)
		//panic(err)
	}

	//运行程序
	err = service.Run()
	if err != nil {
		logs.Error("service run return , err:%v", err)
		panic(err)
		return
	}

}
